/*

#include "driver.h"
//#include "port.h"
#include "driverjack.h"
#include "globals.h"
//#include "buffer.h"
#include "engine.h"

#include <QMutex>
#include <QWaitCondition>


Driver::Driver(Engine & engine):

        driverJack_ (new DriverJack("QKeyMetro")), engine_(engine),
        waitCondition_(driverJack_->getWaitCondition())
        //        inPort_(new Port(false, NC_STEREO, QString("Master_IN"))),
        //        outPort_(new Port(true, NC_STEREO, QString("Master_OUT"))),

{
    driverJack_->init(setBufferSize, setSampleRate);
}

void Driver::setBufferSize(int size){
    Gl::log(QString("DRV: Buffer size is changed : %1").arg(size));
}

void Driver::setSampleRate(int rate){
    Gl::log(QString("DRV: Sample rate is changed : %1").arg(rate));
}


Driver::~Driver()
{
    driverJack_->stop();
}



void Driver::connectPorts (Port & portOut, Port & portIn){
    driverJack_->registerPort( (DJ::Sample**) portOut.getBuffer(0)->getData(), true, portOut.getName() + QString("L"));
    driverJack_->registerPort((DJ::Sample**) portOut.getBuffer(1)->getData(), true, portOut.getName() + QString("R"));

    portIn.setBuffer(QSharedPointer<Buffer>(new Buffer()), 0);
    portIn.setBuffer(QSharedPointer<Buffer>(new Buffer()), 1);

    driverJack_->registerPort((DJ::Sample**) portIn.getBuffer(0)->getData(), false, portIn.getName() + QString("L"));
    driverJack_->registerPort((DJ::Sample**) portIn.getBuffer(1)->getData(), false, portIn.getName()+ QString("R"));
}


void Driver::run(){
    Gl::log("ENG: thread started...");
    QMutex mutex;
    while (not isFinishing_){
        mutex.lock();
        waitCondition_->wait(&mutex);
        engine_.process();
        mutex.unlock();
    }
    Gl::log("ENG: thread stopped...");
}

*/
